package com.loma.common.customUI;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.TextView;

import androidx.annotation.Keep;
import androidx.annotation.Nullable;
@Keep
@SuppressLint("AppCompatCustomView")
public class IconView extends TextView {

    private String iconFontPath;
    private String iconFontTx;

    public IconView(Context context) {
        this(context, null, 0);
    }

    public IconView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public IconView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initParams(context, attrs);
    }

    private void initParams(Context context, AttributeSet attrs) {
//        TypedArray typedArray = context.obtainStyledAttributes(attrs, android.R.styleable.iconfont);
//        if (typedArray != null) {
//            Log.d("initParams", "------->typedArray != null");
//            iconFontPath = typedArray.getString(R.styleable.iconfont_icon_font_path);
////            if (!TextUtils.isEmpty(iconFontPath)) {
////                Typeface iconfont1 = Typeface.createFromAsset(context.getAssets(), "iconfont/iconfont.ttf");
////                if (iconfont1 != null) {
////                    this.setTypeface(iconfont1);
////                }
////
////            }
//
//            Typeface iconfont1 = Typeface.createFromAsset(context.getAssets(), "iconfont/iconfont.ttf");
//            if (iconfont1 != null) {
//                this.setTypeface(iconfont1);
//            }
//            typedArray.recycle();
//        }


        Typeface iconfont1 = Typeface.createFromAsset(context.getAssets(), "iconfont/iconfont.ttf");
        if (iconfont1 != null) {
            this.setTypeface(iconfont1);
        }

    }


}